package com.javatiaocao.myblog.service;

import com.javatiaocao.myblog.model.BlogUser;
import com.javatiaocao.myblog.model.User;
import com.javatiaocao.myblog.model.UserDTO;
import com.javatiaocao.myblog.utils.DataMap;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Repository;

import javax.servlet.http.HttpSession;
import java.util.Collection;


@Repository
public interface UserService {
    /*
添加用户
*/
    public boolean save(BlogUser user);
    /*
    修改
     */
    public boolean update(BlogUser user);
    /*
    删除
    */
    public boolean delete(Integer id);
    /*获取*/
    BlogUser get(Integer id);

    User findByPhone(String phone);

    DataMap register(User user);

    UserDTO findExistUsername(String username);

    DataMap login(UserDTO userDTO, HttpSession session);

    DataMap changePasswordByPhone(String phone,String newPassword);

    Collection<? extends GrantedAuthority> getAuthorities(int id);

    DataMap canYouWrite(UserDetails userDetails);


    DataMap getUserPersonalInfo(String phone);
}
